package com.account.core.dto;

import java.util.List;

/**
 * 通用返回结果封装类
 */
public class ApiResultsResponse<T> {

    private String status;      // "success" 或 "error"
    private List<ApiResponse<T>> results;             // 返回的数据内容

    // 默认构造函数
    public ApiResultsResponse() {
    }

    // 成功时返回数据
    public static <T> ApiResultsResponse<T> success(List<ApiResponse<T>> results) {
        ApiResultsResponse<T> response = new ApiResultsResponse<>();
        response.setStatus("success");
        response.setResults(results);
        return response;
    }

    // 失败时返回错误信息
    public static <T> ApiResultsResponse<T> error() {
        ApiResultsResponse<T> response = new ApiResultsResponse<>();
        response.setStatus("error");
        return response;
    }

    // Getters and Setters
    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public List<ApiResponse<T>> getResults() {
        return results;
    }

    public void setResults(List<ApiResponse<T>> results) {
        this.results = results;
    }
}
